/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package estates.facade;

import estates.model.Estate;
import estates.model.User;
import java.util.ArrayList;
import java.util.HashMap;

public class UsersFactory {

    public User createUserTemplate(HashMap<String,Object> dane) {
        User u = new User();
        if(dane.containsKey("nip"))u.setNIP((String)dane.get("nip"));
        return u;
    }

    public User createUser(HashMap<String,Object> dane) {
        User u = new User();
        if(dane.containsKey("userType"))u.setUserTypes((Integer)dane.get("userType"));
        if(dane.containsKey("login"))u.setLogin((String)dane.get("login"));
        if(dane.containsKey("pesel"))u.setPesel((String)dane.get("pesel"));
        if(dane.containsKey("additionalInf"))u.setAdditionalInf((String)dane.get("additionalInf"));
        if(dane.containsKey("city"))u.setCity((String)dane.get("city"));
        if(dane.containsKey("houseNr"))u.setHouseNr((String)dane.get("houseNr"));
        if(dane.containsKey("mail"))u.setMail((String)dane.get("mail"));
        if(dane.containsKey("nip"))u.setNIP((String)dane.get("nip"));
        if(dane.containsKey("name"))u.setName((String)dane.get("name"));
        if(dane.containsKey("password"))u.setPassword((String)dane.get("password"));
        if(dane.containsKey("phone"))u.setPhone((String)dane.get("phone"));
        if(dane.containsKey("postCode"))u.setPostCode((String)dane.get("postCode"));
        if(dane.containsKey("regon"))u.setRegon((String)dane.get("regon"));
        if(dane.containsKey("street"))u.setStreet((String)dane.get("street"));

        u.setEstates(new ArrayList<Estate>());
        u.setObserwowane(new ArrayList<Estate>());
        return u;
    }


}
